Method and device for generating a prediction block to encode and decode an image

ABSTRACT

A method for decoding an image according to the present invention comprises the steps of: restoring a residual block by performing inverse quantization and inverse transformation for the entropy-decoded residual block; generating a prediction block by performing intra prediction for a current block; and restoring an image by adding the restored residual block to the prediction block, wherein the step of generating the prediction block further comprises a step for generating a final prediction value of a pixel to be predicted, on the basis of a first prediction value of the pixel to be predicted, which is included in the current block, and of a final correction value that is calculated by performing an arithmetic right shift by a binary digit 1 for a two&#39;s complement integer representation with respect to an initial correction value of the pixel to be predicted. Thus, the operational complexity during image encoding/decoding can be reduced.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of application Ser. No. 14/446,447filed Jul. 30, 2014, which is a division of application Ser. No.14/372,278 filed on Jul. 15, 2014, which is a national stage applicationof International Application No. PCT/KR2013/000417 filed on Jan. 18,2013, which claims the benefit of Korean Patent Application No.10-2012-0005950 filed on Jan. 18, 2012, Korean Patent Application No.10-2013-0005653 filed on Jan. 18, 2013, and Korean Patent ApplicationNo. 10-2013-0093305 filed on Aug. 6, 2013, the entire disclosures ofwhich are incorporated herein by reference for all purposes.

TECHNICAL FIELD

The present invention concerns a method and apparatus for encoding anddecoding an images, and more specifically, to an intra prediction andinter prediction method by reducing computation complexity.

BACKGROUND ART

Recent spread of HD (High Definition) broadcast services nationwide andworldwide makes more users familiar with high-resolution, high-qualityimages, and many organizations put more efforts to development ofnext-generation imaging devices. Further, more interest is orientedtowards UHD (Ultra High Definition) having 4 times or more resolutionthan HDTV, as well as HDTV, so that image compression technologies forhigher-resolution, higher-quality images are demanded.

For purposes of image compression, an inter prediction for predicting apixel value included in a current picture from a temporally previousand/or subsequent picture, an intra prediction for predicting a pixelvalue included in a current picture by using pixel information in thecurrent picture, and an entropy encoding for assigning a shorter code toa more frequent symbol while assigning a longer code to a less frequentsymbol may be used.

Technical Problem

An object of the present invention is to provide an image encodingmethod and apparatus that may enhance image encoding/decoding efficiencyby reducing computation complexity.

Another object of the present invention is to provide an image decodingmethod and apparatus that may enhance image encoding/decoding efficiencyby reducing computation complexity.

Still another object of the present invention is to provide a predictionblock generating method and apparatus that may enhance imageencoding/decoding efficiency by reducing computation complexity.

Yet still another object of the present invention is to provide an intraprediction method and apparatus that may enhance image encoding/decodingefficiency by reducing computation complexity.

Yet still another object of the present invention is to provide an interprediction method and apparatus that may enhance image encoding/decodingefficiency by reducing computation complexity.

Technical Solution

To achieve the above objects, an image decoding method according to thepresent invention includes the steps of reconstructing a residual blockby inverse-quantizing and inverse-transforming an entropy-decodedresidual block, generating a prediction block by performing intraprediction on a current block, and reconstructing an picture by addingthe reconstructed residual block to the prediction block, the step ofgenerating the prediction block includes the step of generating a finalprediction value of a prediction target pixel included in the currentblock based on a first prediction value of the prediction target pixeland a final correction value calculated by performing an arithmeticright shift on a two's complementary integer representation for aninitial correction value of the prediction target pixel by a binarydigit of 1.

The step of generating the prediction block may include the steps ofdetermining whether to correct an intra prediction value depending onencoding information of the current block and a position of theprediction target pixel in the current block and generating a finalprediction value of the prediction target pixel based on a result of thedetermination.

The step of determining whether to correct may include the step ofdetermining whether to correct the intra prediction value considering atleast one of an intra prediction mode of the current block, luma signalinformation, chroma signal information, and a block size.

The step of determining whether to correct may include the step ofdetermining that, in a case where an intra prediction mode of thecurrent block is a vertical direction prediction mode, correction may beperformed on a pixel positioned at a left boundary in the current block.

The step of determining whether to correct may include the step ofdetermining that, in a case where an intra prediction mode of thecurrent block is a horizontal direction prediction mode, correction maybe performed on a pixel positioned at an upper boundary in the currentblock.

The step of generating the final prediction value may include, in a casewhere correction is determined to be performed on an intra predictionvalue, the steps of obtaining a first prediction value using a value ofa reference pixel adjacent to the current block, determining an initialcorrection value depending on a horizontal or vertical position of theprediction target pixel in the block, calculating a final correctionvalue by performing an arithmetic right shift on the two's complementaryinteger representation for the initial correction value by a binarydigit of 1, and calculating the final prediction value based on thefirst prediction value and the final correction value.

In a case where the intra prediction mode is a vertical directionprediction mode, correction may be performed on a pixel positioned at aleft boundary of the current block, the first prediction value may begenerated using a value of an upper reference pixel adjacent to thecurrent block, the initial correction value may be determined using adifference between a value of a left reference pixel corresponding to avertical position of the prediction target pixel in the block and avalue of a left and upper cornered reference pixel adjacent to thecurrent block, and in a case where the intra prediction mode is ahorizontal direction prediction mode, correction may be performed on apixel positioned at an upper boundary of the current block, the firstprediction value may be generated using a value of a left referencepixel adjacent to the current block, the initial correction value may bedetermined using a difference between a value of an upper referencepixel corresponding to a horizontal position of the prediction targetpixel in the block and a value of a left and upper cornered pixel of thecurrent block.

The step of generating the final prediction value may include, in a casewere no correction is determined to be performed on the intra predictionvalue, the steps of generating a final prediction value of theprediction target pixel based on a value of an upper reference pixeladjacent to the current block in a vertical direction prediction mode,and generating a final prediction value of the prediction target pixelbased on an value of an upper reference pixel adjacent to the currentblock in a horizontal direction prediction mode.

The image decoding method further may include the step of determining areference pixel to be used for performing intra prediction on theprediction target pixel, the step of determining the reference pixel mayinclude the steps of determining a reference pixel using an alreadyreconstructed pixel among pixels adjacent to the current block andperforming smoothing filtering on a pixel value of the reference pixel.

To achieve the above-described objects, an image decoding apparatusaccording to the present invention may include a residual blockreconstructing unit that reconstructs a residual block byinverse-quantizing and inverse-transforming an entropy-decoded residualblock, a prediction block generating unit that generates a predictionblock by performing intra prediction on a current block, and an picturereconstructing unit that reconstructs an picture by adding the residualblock to the prediction block, the prediction block generating unitgenerates a final prediction value of a prediction target pixel includedin the current block based on a first prediction value of the predictiontarget pixel and a final correction value calculated by performing anarithmetic right shift on a two's complementary integer representationfor an initial correction value of the prediction target pixel by abinary digit of 1.

To achieve the above-described objects, an image encoding methodaccording to the present invention may include the steps of generating aprediction block by performing intra prediction on an input image andperforming entropy encoding by transforming and quantizing a residualblock that is a difference between a prediction block predicted by intraprediction and a current prediction block, the step of generating theprediction block may include the step of generating a final predictionvalue of a prediction target pixel included in the current block basedon a first prediction value of the prediction target pixel and a finalcorrection value calculated by performing an arithmetic right shift on atwo's complementary integer representation for an initial correctionvalue of the prediction target pixel by a binary digit of 1.

To achieve the above-described objects, an image encoding apparatusaccording to the present invention may include a prediction blockgenerating unit that generates a prediction block by performing intraprediction on an input image and an encoding unit that performs entropyencoding by transforming and quantizing a residual block that is adifference between a prediction block predicted by intra prediction anda current prediction block, the step of generating the prediction blockmay include the step of generating a final prediction value of aprediction target pixel included in the current block based on a firstprediction value of the prediction target pixel and a final correctionvalue calculated by performing an arithmetic right shift on a two'scomplementary integer representation for an initial correction value ofthe prediction target pixel by a binary digit of 1.

To achieve the above-described objects, an image decoding methodaccording to the present invention may include the steps ofreconstructing a residual block by inverse-quantizing andinverse-transforming an entropy-decoded residual block, generating aprediction block by performing intra prediction on a current block, andreconstructing an picture by adding the reconstructed residual block tothe prediction block, the step of generating the prediction block mayinclude the steps of determining whether a reference picture of thecurrent block is the same as a reference picture of the reference blockand in a case where it is determined that the reference picture of thecurrent block is not the same as the reference picture of the referenceblock, scaling a motion vector of the reference block and using thescaled motion vector for prediction of the current block.

Upon inducing a spatial or temporal motion vector and upon inducing atemporal merge candidate, the used reference block may include i) uponinducing the spatial motion vector, at least one of a lowermost blockadjacent to a left side of the current block, a block adjacent to alower side of the left and lowermost block, a left and upper corneredblock of the current block, a right and upper cornered block of thecurrent block, and an upper and rightmost block adjacent to the currentblock, and ii) upon inducing the temporal motion vector and iii) uponinducing the temporal merge candidate, at least one of blocks positionedin and outside a co-located block spatially corresponding to the currentblock in a co-located picture of a current picture.

The step of generating the prediction block may include the steps ofobtaining first and second values based on a POC (Picture Order Count)difference between the pictures, calculating an inverse-proportionalvalue of the first value by calculating an offset value by performing anarithmetic right shift on a two's complementary integer representationfor an absolute value of the first value by a binary digit of 1, andcalculating the scaling factor based on the inverse-proportional valueof the first value and the second value.

i) upon inducing the spatial motion vector, the first value may be adifference between a POC of a current picture and a POC of a referencepicture referred to by the reference block, and the second value may bea difference between a POC of the current picture and a POC of areference picture referred to by the current block, and ii) uponinducing the temporal motion vector or iii) upon inducing the temporalmerge candidate, the first value may be a difference between a POC of aco-located picture and a POC of a reference picture referred to by aco-located block and the current block in the co-located picture, andthe second value may be a difference between a POC of a current blockpicture and a POC of a reference picture referred to by the currentblock.

The step of calculating the scaling factor may include the steps ofcalculating the scaling factor by performing an addition operation andan arithmetic right shift operation based on multiplication of theinverse-proportional value of the first value and the second value andadjusting the scaling factor to be included in a specific range.

To achieve the above-described objects, an image decoding apparatusaccording to the present invention may include a residual blockreconstructing unit that reconstructs a residual block byinverse-quantizing and inverse-transforming an entropy-decoded residualblock, a prediction block generating unit that generates a predictionblock by performing intra prediction on a current block, and an picturereconstructing unit that reconstructs an picture by adding thereconstructed residual block to the prediction block, the predictionblock generating unit may include a sameness determining unit thatdetermines whether a reference picture of the current block is the sameas a reference picture of the reference block and a scaling unit that,in a case where the reference of the current block is not the same asthe reference picture of the reference block, scales a motion vector ofthe reference block and uses the scaled motion vector for prediction ofthe current block.

To achieve the above-described objects, an image encoding methodaccording to the present invention may include the steps of generating aprediction block by performing intra prediction on an input image andperforming entropy encoding by transforming and quantizing a residualblock that is a difference between the current input block and aprediction block predicted by intra prediction, the step of generatingthe prediction block may include the steps of determining whether areference picture of the current block is the same as a referencepicture of the reference block and in a case where the reference of thecurrent block is not the same as the reference picture of the referenceblock, scaling a motion vector of the reference block and using thescaled motion vector for prediction of the current block.

To achieve the above-described objects, an image encoding apparatusaccording to the present invention may include a prediction blockgenerating unit that generates a prediction block by performing intraprediction on an input image and an encoding unit that performs entropyencoding by transforming and quantizing a residual block that is adifference between the current input block and a prediction blockpredicted by intra prediction, the prediction block generating unit mayinclude a sameness determining unit that determines whether a referencepicture of the current block is the same as a reference picture of thereference block and a scaling unit that, in a case where the referenceof the current block is not the same as the reference picture of thereference block, scales a motion vector of the reference block and usesthe scaled motion vector for prediction of the current block.

Advantageous Effects

The image encoding method according to the present invention may reducecomputation complexity and enhance image encoding/decoding efficiency.

The image decoding method according to the present invention may reducecomputation complexity and enhance image encoding/decoding efficiency.

The prediction block generating method according to the presentinvention may reduce computation complexity and enhance imageencoding/decoding efficiency.

The intra prediction method according to the present invention mayreduce computation complexity and enhance image encoding/decodingefficiency.

The inter prediction method according to the present invention mayreduce computation complexity and enhance image encoding/decodingefficiency.

DESCRIPTION OF DRAWINGS

FIG. 1 is a block diagram illustrating a configuration of an imageencoding apparatus according to an embodiment of the present invention.

FIG. 2 is a block diagram illustrating a configuration of an imagedecoding apparatus according to an embodiment of the present invention.

FIG. 3 is a flowchart illustrating a process of producing a finalprediction value of a current block in an image encoding/decoding methodaccording to an embodiment of the present invention.

FIG. 4 is a flowchart schematically illustrating a process of yielding areference pixel to be used for intra prediction according to anembodiment of the present invention.

FIG. 5 is a view schematically illustrating the replacement of anunavailable pixel in a process of yielding a reference picture to beused for intra prediction according to an embodiment of the presentinvention.

FIG. 6 is a flowchart schematically illustrating a process ofdetermining whether to correct an intra prediction value depending onthe position of a prediction target pixel and encoding information of acurrent block.

FIG. 7a is a view schematically illustrating an embodiment in which in avertical prediction mode a first prediction value for a pixel in acurrent block is used as a final prediction value.

FIG. 7b is a view schematically illustrating an embodiment in which in ahorizontal prediction mode a first prediction value for a pixel in thecurrent block is used as the final prediction value.

FIG. 8 is a flowchart schematically illustrating an embodiment in whichcorrection is performed on a first prediction value for a pixel in acurrent block to yield a final prediction value.

FIG. 9a is a view schematically illustrating an embodiment for producinga final prediction value by performing correction on a first predictionvalue when using a vertical mode.

FIG. 9b is a view schematically illustrating an embodiment for producinga final prediction value by performing correction on a first predictionvalue when using a horizontal mode.

FIG. 10 is a flowchart schematically illustrating a process ofperforming scaling in an image encoding/decoding method according toanother embodiment of the present invention.

FIG. 11a is a view illustrating a POC difference between a currentpicture and a current picture of a spatial reference block and a POCdifference between the current picture and a reference picture of thecurrent block.

FIG. 11b is a view illustrating a POC difference between a referencepicture of a co-located block and a co-located picture and a POCdifference between a current picture and a reference picture of acurrent block.

FIG. 12 is a flowchart schematically illustrating an embodiment of aprocess of calculating a scaling factor for a motion vector based on POCdifferences between pictures.

FIG. 13 is a block diagram schematically illustrating a configuration ofcalculating a final scaling factor based on tb and aninverse-proportional value of td.

BEST MODEL

Hereinafter, embodiments of the present invention will be described indetail with reference to the accompanying drawings. In describing theembodiments, when determined to make the gist of the invention unclear,the detailed description on the well-known configurations or functionswill be omitted.

When a component is “connected to” or “coupled to” another component,the component may be directly connected or coupled to the othercomponent, or other components may also intervene. Further, when aspecific component is “included”, other components are not excluded butmay be included, and such configuration is also included in the scope ofthe invention.

The terms “first” and “second” may be used to describe variouscomponents, but the components are not limited thereto. These terms areused only to distinguish one component from another. For example, thefirst component may be also named the second component, and the secondcomponent may be similarly named the first component.

The constitutional parts in the embodiments are independently shown torepresent different features, but this does not mean that eachconstitutional part is formed of a separate hardware unit or onesoftware constitutional unit. That is, each constitutional part isseparated from the others for ease of description. At least two of theconstitutional parts may be combined into a single constitutional part,or one constitutional part may be divided into a plurality ofconstitutional parts which may perform functions, respectively. Theembodiments covering the combinations of the constitutional parts or theseparation thereof may be included in the scope of the invention withoutdeparting from the gist of the invention.

Some constitutional parts are not essential ones to perform theinevitable functions of the present invention but rather may be optionalconstitutional parts to enhance performance. The present invention maybe implemented only by the constitutional parts necessary for realizingthe gist of the invention or such a configuration that includes only theessential constitutional parts excluding the optional constitutionalparts used for enhancing performance may also be included in the scopeof the present invention.

FIG. 1 is a block diagram illustrating a configuration of an imageencoding apparatus according to an embodiment of the present invention.

Referring to FIG. 1, the multi-view video image decoding apparatus 100includes a motion prediction unit 111, a motion compensation unit 112,an intra prediction unit 120, a switch 115, a subtractor 125, atransform unit 130, a quantization unit 140, an entropy encoding unit150, an inverse quantization unit 160, an inverse transform unit 170, anadder 175, a filter unit 180, and a reference image buffer 190. Here,the term “image” may be used to have the same meaning as the term“picture” to be described below.

The image encoding apparatus 100 may perform encoding on an input imagein an intra mode or inter mode and may output a bit stream. The intraprediction means intra-screen prediction, and the inter prediction meansinter-screen prediction. In the intra mode, the switch 115 may shift tointra, and in the inter mode, the switch 115 may shift to inter. Theimage encoding apparatus 100 may generate a prediction block on an inputblock of the input image and may then encoding a differential betweenthe input block and the prediction block.

In the intra mode, the intra prediction unit 120 may generate aprediction block by performing spatial prediction using a pixel value ofan already encoded block adjacent to a current block.

In the inter mode, the motion prediction unit 111 may obtain a motionvector by figuring out an area that best matches an input block of areference image stored in the reference image buffer 190 during thecourse of motion prediction. The motion compensation unit 112 maygenerate a prediction block by performing motion compensation using amotion vector. Here, the motion vector is a 2D (two-dimensional) vectorused for inter prediction, and may represent an offset between a currentencoding/decoding target image and a reference image.

The subtractor 125 may generate a residual block based on a differentialbetween an input block and a generated prediction block. The transformunit 130 may perform transform on a residual block to output a transformcoefficient. The quantization unit 140 may perform quantization on aninput transform coefficient based on a quantization parameter to outputa quantized coefficient.

The entropy encoding unit 150 may perform entropy encoding based on aencoding parameter value produced during the course of encoding orvalues produced by the quantization unit 140 to thereby output a bitstream.

When entropy encoding applies, a fewer number of bits are assigned to asymbol having a higher probability of occurrence, while a more number ofbits are assigned to a symbol having a lower probability of occurrence,so that the size of the bit stream for the encoding target symbols maybe reduced. Accordingly, the compression performance of image encodingmay be increased through entropy encoding. The entropy encoding unit 150may adopt encoding schemes, such as exponential golomb,CAVLC(Context-Adaptive Variable Length Coding), CABAC(Context-AdaptiveBinary Arithmetic Coding), for purposes of entropy encoding.

Since the image encoding apparatus shown in FIG. 1 conducts interprediction encoding, i.e., inter-frame prediction encoding, a currentlyencoded image needs to be decoded and then stored to be used as areference image. Accordingly, a quantized coefficient isinverse-quantized in the inverse quantization unit 160, andinverse-transformed in the inverse transform unit 170. Aninverse-quantized, inverse-transformed coefficient is added to aprediction block through the adder 175, thereby producing areconstructed block.

The reconstructed block passes through the filter unit 180 that mayapply at least one or more of a deblocking filter, SAO (Sample AdaptiveOffset), and ALF (Adaptive Loop Filter) to a reconstructed block orreconstructed picture. The filter unit 180 may be also called anadaptive in-loop filter. The deblocking filter may remove a distortionthat occurs at a boundary between blocks. The SAO may add a properoffset value to a pixel value so as to compensate for a coding error.The ALF may perform filtering based on a value obtained by comparing areconstructed image with an original image. A reconstructed block whichhas passed through the filter unit 180 may be stored in the referenceimage buffer 190.

FIG. 2 is a block diagram illustrating a configuration of an imagedecoding apparatus according to an embodiment of the present invention.

Referring to FIG. 2, the image decoding apparatus 200 includes anentropy decoding unit 210, an inverse-quantization unit 220, aninverse-transform unit 230, an intra prediction unit 240, a motioncompensation unit 250, an adder 255, a filter unit 260, and a referencepicture buffer 270.

The image decoding apparatus 200 may receive a bit stream output from anencoder, perform decoding in an intra mode or inter mode, and output areconstructed image, i.e., a reconstructed image. In the intra mode, theswitch may shift to intra, and in the inter mode, the switch may shiftto inter. The image decoding apparatus 200 may obtain a reconstructedresidual block from a received bit stream, generate a prediction block,and add the reconstructed residual block to the prediction block tothereby generate a reconstructed block, i.e., a reconstructed block.

The entropy decoding unit 210 may entropy-decode an input bit streamaccording to a probability distribution to thereby generate symbolsincluding quantized coefficient types of symbols. Entropy decodingschemes are similar to the above-described entropy encoding schemes.

When an entropy decoding scheme applies, a less number of bits areassigned to a symbol having a higher probability of occurrence, with amore number of bits assigned to a symbol having a lower probability ofoccurrence, so that the size of the bit stream for each symbol may bereduced. Accordingly, compression performance of image decoding may beincreased through the entropy decoding scheme.

A quantized coefficient may be inverse-quantized in theinverse-quantization unit 220, and inverse-transformed in theinverse-transform unit 230. As a result of inverse quantization/inversetransform of the quantized coefficient, a reconstructed residual blockmay be generated.

In the intra mode, the intra prediction unit 240 may generate aprediction block by performing spatial prediction using a pixel value ofan already encoded/decoded block adjacent to a current block. In theinter mode, the motion compensation unit 250 may generate a predictionblock by performing motion compensation using a reference image storedin the reference picture buffer 270 and a motion vector.

The reconstructed residual block and prediction block are added to eachother through the adder 255, and the resultant block may go through thefilter unit 260. The filter unit 260 may apply at least one or more of adeblocking filter, SAO, and ALF to a reconstructed block or areconstructed picture. The filter unit 260 may output a reconstructedimage, i.e., a reconstructed image. The reconstructed image may bestored in the reference picture buffer 270 and may be used for interprediction.

Hereinafter, the “unit” means a basis on which image encoding anddecoding are carried out. Upon image encoding and decoding, a unit forencoding or decoding is the one split from an image for purposes ofencoding or decoding, and thus, the unit may be also referred to as ablock, a coding unit (CU), a prediction unit (PU), a transform unit(TU), etc. Further, the unit may be also denoted as a block in someembodiments to be described below. One unit may be further split intosub units having a smaller size. Further, the “current block” usedherein may refer to a block that is targeted for intra prediction ormotion compensation. In case intra prediction is performed, the currentblock may mean any one of a prediction unit, a prediction block, atransform unit, and a transform block, and in case motion compensationis performed, the current block may mean one of a prediction unit and aprediction block.

FIG. 3 is a flowchart illustrating a process of producing a finalprediction value of a current block in an image encoding/decoding methodaccording to an embodiment of the present invention.

Referring to FIG. 3, an image encoding/decoding apparatus according toan embodiment of the present invention produces a final prediction valuebased on a reference pixel to generate a prediction block for a currentblock. For this purposes, the image encoding/decoding apparatus obtainsa pixel value of a reference pixel to be used for intra prediction(S310). An already reconstructed pixel of pixels adjacent to the currentblock may be used as the reference pixel. if the adjacent pixels areunavailable, the pixel values of the unavailable pixels may be replacedwith the value of the corresponding reference pixel. After the referencepixel is obtained, encoding information of the current block andin-block position information of a prediction target pixel are obtained(S320). Then, it is determined whether it is needed to correct a firstprediction value through the reference pixel value based on the encodinginformation and the in-block position information of the predictiontarget pixel (S330). At this time, the determination may be changedbased on at least one of intra (intra-frame) prediction modeinformation, brightness signal information, color difference signalinformation and block size.

In case it is determined that no correction is needed, the imageencoding/decoding apparatus may directly utilize the first predictionvalue as the final prediction value of the current block (S340). On thecontrary, if a correction is determined to be required, the imageencoding/decoding apparatus may first obtain the first prediction valueand a corrected value and may add the first prediction value to thecorrected value to thereby yield a final prediction value (S350). Atthis time, the complexity of computation associated with the calculationof the corrected value is generally very high, so that it may beconsidered for purposes of reducing such complexity to conduct anarithmetic right shift operation. The arithmetic right shift operation(“>>”) has the characteristic that the sign of a value targeted for theoperation does not vary, and in contrast to the common integer dividingoperation (“/”) which renders a result rounded to be close to 0, leavesa result rounded to reach negative infinity.

FIG. 4 is a flowchart schematically illustrating a process of yielding areference pixel to be used for intra prediction according to anembodiment of the present invention.

Referring to FIG. 4, an encoding/decoding apparatus determines whether apixel value of an adjacent block may be used based on pixel informationof an adjacent block of a current block (S410). At this time, when nopixel value of the adjacent block may be used may be one of i) when thepixel of the adjacent block is outside a picture boundary, ii) when thepixel of the adjacent block is outside a slice/tile boundary, and iii)when CIP (constrained_intra_pred_flag) is 1—that is, when the currentblock is a CIP-applied block and the adjacent block is a block encodedby inter prediction. As such, in case the pixel value of the adjacentblock may not be used as a reference pixel value, the correspondingreference pixel value may be replaced with an available pixel value ofanother adjacent block or a specific default (S420).

FIG. 5 is a view schematically illustrating the replacement of anunavailable pixel in a process of yielding a reference picture to beused for intra prediction according to an embodiment of the presentinvention.

Referring to FIG. 5, adjacent blocks of a current block 500 may be usedto obtain a reference pixel value. At this time, as adjacent blocks tobe used for obtaining a reference pixel value, there may be an adjacentblock adjacent to the current block 500, an adjacent block adjacent to alower side of a left and lowermost adjacent block by the height of thecurrent block 500, and an adjacent block adjacent to a right side of atop and rightmost adjacent block by the width of the current block 500.At this time, among pixels of the adjacent blocks, only pixelspositioned adjacent to the current block 500 may be used as thereference pixel.

At this time, in case the adjacent blocks may not be used to obtain thereference pixel value, it may be replaced with an available pixel valueof another adjacent block. In FIG. 5, among the adjacent blocks of thecurrent block 500, hatched ones are available blocks, and the others areunavailable blocks.

According to an embodiment of the present invention, the imageencoding/decoding apparatus may determine whether a pixel positionedadjacent to the current block 500 is available, and may store a resultof the determination. For example, the apparatus may determine that, inFIG. 5, pixels in the hatched blocks are available ones and pixels inthe non-hatched blocks are unavailable and may store a result. At thistime, in case one or more unavailable pixels are present, theunavailable pixel values may be replaced with an available pixel value.

Shifting from a pixel 520 at position A as a start point to a pixel 522at position B, an unavailable pixel may be replaced with an availablepixel value that comes right before the unavailable pixel. At this time,in case the pixel 520 at the start point is unavailable, the pixel valueof an available pixel 512 that comes first when shifting from position Ato position B may be replaced with the pixel 520 value of the startpoint. Among the adjacent blocks 510, 530, and 532, the adjacent block510 is available, and the adjacent blocks 530 and 532 are unavailable.Accordingly, the pixel 520 at the start point is an unavailable pixel.The pixel 520 at the start point may be replaced with the pixel value ofan available pixel 512 that first comes as goes from position A toposition B, a pixel of the adjacent block 530 may be replaced with thepixel value of the pixel 512, and a pixel of the adjacent block 532 maybe replaced with the pixel value of a pixel 514 that is an availablepixel coming right before it. In such way, unavailable pixels may bereplaced with available pixels until reaching position B.

Turning back to FIG. 4, in case a result of determining whether adjacentblock pixels are available shows that the pixel value of an adjacentblock is available, the pixel value of the adjacent block may be, as is,used as the reference pixel value (S422).

The image encoding/decoding apparatus may perform smoothing filtering onan obtained reference pixel value (S430). At this time, the smoothingfiltering may be conducted in a different way according to the size of atarget block and/or intra prediction mode.

FIG. 6 is a flowchart schematically illustrating a process ofdetermining whether to correct an intra prediction value depending onthe position of a prediction target pixel and encoding information of acurrent block.

Referring to FIG. 6, the image encoding/decoding apparatus may determinewhether to perform correction based on an in-block position of aprediction target pixel and current block encoding information. Theencoding information used for determining whether to perform correctionmay include any one of intra prediction mode information, brightnesssignal information, color difference signal information, and block size,as described above.

In order to determine whether to perform correction, the imageencoding/decoding apparatus first determines whether an intra predictionmode of a current block is a vertical prediction mode (S610). In thevertical prediction mode, it is determined whether the prediction targetpixel is a pixel positioned at a left boundary of the current block(S612). If it is determined as a pixel positioned at the left boundary,correction is determined to be performed (S632). In case the intraprediction mode is the vertical prediction mode but the pixel is notpositioned at the left boundary, no correction may be performed (S630).Determination on the vertical prediction mode and horizontal predictionmode may be conducted with reference to what is to be described below.In determining the horizontal prediction mode, it may be strictlydetermined whether the prediction direction is exactly the horizontaldirection, but further eased conditions may apply to determine whetherthe prediction direction is close to the horizontal direction. As anexample of horizontal prediction mode determination using mitigatedconditions, if upon horizontal prediction mode determination, theprediction direction of the target prediction mode is within 30 degreesof the horizontal direction, it may be determined as the horizontalprediction mode. At this time, the degree, as a reference of thedetermination, is not necessarily limited to 30 degrees, and otherangles may be also used as the reference. Also in determining thevertical prediction mode, as in determining the horizontal predictionmode, more smooth conditions may be used to determine whether theprediction direction is close to the vertical direction or not. Althoughin the subsequent embodiments it is strictly determined whether theprediction direction is the horizontal and vertical directions, thepresent invention is not limited thereto, and examples wheredetermination on the horizontal and/or vertical directions is made basedon the mitigated conditions as described above also belong to the scopeof the present invention.

Then, whether it is a horizontal prediction mode is determined (S620).The steps of determining the vertical prediction mode and horizontalprediction mode (S610 and S620) are not essentially associated with eachother, and the order of performing the steps S610 and S620 may bechanged. In the case of the horizontal prediction mode, it is determinedwhether the prediction target pixel is a pixel positioned at an upperboundary of a current block (S622). If it is determined that theprediction target pixel is a pixel positioned at the upper boundary,correction is determined to be performed (S632). In case the intraprediction mode is a horizontal prediction mode but the pixel is notpositioned at the upper boundary, no correction may be performed (S630).In case the intra prediction mode is not a vertical or horizontalprediction mode, no correction on a prediction value for a current blockmay be conducted (S630).

According to an embodiment of the present invention, correction on theprediction value for the current block may be done in consideration ofat least one of the intra prediction mode and block size as describedabove only with respect to the brightness (luma) signal, but not withrespect to the color difference (chroma) signal.

According to another embodiment of the present invention, predictionvalue correction may be conducted on a block having a size of 32×32 orless. In other words, prediction value correction may be performed on ablock having a size of 4×4, 8×8, and 16×16.

According to still another embodiment of the present invention, in casethe inter prediction mode is a DC mode, correction may be done on pixelspositioned at the top and left boundaries of a current block.

FIG. 7a is a view schematically illustrating an embodiment in which in avertical prediction mode a first prediction value for a pixel in acurrent block is used as a final prediction value, and FIG. 7b is a viewschematically illustrating an embodiment in which in a horizontalprediction mode a first prediction value for a pixel in the currentblock is used as the final prediction value.

Referring to FIGS. 7a and 7b , the image encoding/decoding apparatusobtains a first prediction value and then determines, withoutcorrection, the first prediction value as a final prediction value forthe current block 710 when it is determined in the step S330 that nocorrection is to be performed on the prediction value depending on atleast one of intra prediction mode, brightness signal, color differencesignal information and block size.

At this time, the first prediction value (pred1 [x,y]) may be obtainedbased on a reference pixel value. p[x,y] to be described below means thereference pixel value at position [x,y]. Thereafter, in an embodiment,x=−1, . . . , BlockWidth−1, y=−1, . . . , BlockHeight−1. Here,BlockWidth refers to the width of a current block, and BlockHeightrefers to the height of a current block. In the embodiments described inconnection with FIGS. 7a and 7b , a 4×4 block is described as anexample, and in such case, the reference pixel may have a range of x=−1,. . . , 3 and y=−1, . . . , 3, and the pixel of the current block mayhave a range of x=0, . . . , 3 and y=0, . . . , 3.

Referring to FIG. 7a , in the case of vertical direction prediction, thefirst prediction value (pred1[x,y]) may be determined as values (722,724, 726, 728) of upper reference pixels adjacent to the current block.

pred1[x,y]=p[x,−1](x=0, . . . ,BlockWidth−1;y=0, . . .,BlockHeight−1)  [Equation 1]

Assuming that the left and upper side of the current block is positionedat [0,0], the first prediction value (pred1[x,y]) is determined usingthe pixel value of a pixel 722 positioned at [0,−1] with respect topixels at the left boundary of the current block 710, the pixel value ofa pixel 724 positioned at [−1,−1] with respect to pixels at the secondcolumn from the left side, the pixel value of a pixel 726 positioned at[2,−1] with respect to pixels at the third column from the left side,and the pixel value of a pixel 728 positioned at [3,−1] with respect topixels at the right boundary.

The image encoding/decoding apparatus may use the first prediction value(pred1[x,y]) as the final prediction value (predS[x,y]).

predS[x,y]=pred[x,y](x=0, . . . ,BlockWidth−1;y=0, . . .,BlockHeight−1)  [Equation 2]

Here, predS[x,y] refers to a final prediction value.

Referring to FIG. 7b , in the case of horizontal direction prediction,the first prediction value (pred1[x,y]) may be determined as values ofleft reference pixels (732, 734, 736, 738) adjacent to the currentblock.

pred1[x,y]=p[−1,y](x=0, . . . ,BlockWidth−1;y=0, . . .,BlockHeight−1)  [Equation 3]

The first prediction value (pred1[x,y]) is determined using the pixelvalue of a pixel 732 positioned at [−1,0] with respect to pixels at anupper boundary, the pixel value of a pixel 734 positioned at [−1,1] withrespect to pixels at the second row from the upper side, the pixel valueof a pixel 736 positioned at [−1,2] with respect to pixels at the thirdrow from the upper side, and the pixel value of a pixel 738 positionedat [−1,3] with respect to the lower boundary. As in the verticaldirection prediction, even in the horizontal direction prediction, thefirst prediction value (pred1[x,y]) may be used as the final predictionvalue (predS[x,y]).

FIG. 8 is a flowchart schematically illustrating an embodiment in whichcorrection is performed on a first prediction value for a pixel in acurrent block to yield a final prediction value.

Referring to FIG. 8, the image encoding/decoding apparatus obtains afirst prediction value (pred1[x,y]) through a scheme of utilizing theabove-described reference pixel values (refer to FIGS. 7a and 7b ) incase it is determined in step S330 that correction is to be performed onthe prediction value according to at least one of an intra predictionmode, bright signal, color difference signal information and block size(S810).

Then, the apparatus determines an initial correction value (d[x,y]) forthe first prediction value (pred1[x,y]) of a prediction target pixel(S820). The initial correction value (d[x,y]) may be determineddepending on the horizontal or vertical position of the predictiontarget pixel in the block. In other words, in the case of verticaldirection prediction, the initial correction value (d[x,y]) may bedetermined according to the vertical-directional position of theprediction target pixel in the block, and in the case of horizontaldirection prediction, the initial correction value (d[x,y]) may bedetermined according to the horizontal-directional position of theprediction target pixel in the block.

d[x,y]=d[y]=p[−1,y]−p[−1,−1](in case of vertical direction predictionmode)

d[x,y]=d[x]=p[x,−1]−p[−1,−1](in case of horizontal direction predictionmode)  [Equation 4]

In Equation 4, the differentials may be changed in terms of direction asin Equation 4′.

d[x,y]=d[y]=p[−1,−1]−p[−1,y](in case of vertical direction predictionmode)

d[x,y]=d[x]=p[−1,−1]−p[x,−1](in case of horizontal direction predictionmode)  [Equation 4′]

Next, a final correction value (delta[x,y]) is yielded based on theinitial correction value (d[x,y]) (S830). At this time, computationefficiency may be elevated by producing the final correction value(delta[x,y]) through arithmetic right shift showing a relatively lowcomputation complexity without performing division or multiplicationoperation with a high computation complexity. In other words, the finalcorrection value (delta[x,y]) is obtained by arithmeticallyright-shifting a two's complementary integer representation for theinitial correction value (d[x,y]) by a binary digit of M. At this time,the MSB (Most Significant Bit) of the arithmetically right-shifted finalcorrection value (delta[x,y]) is the same as the MSB of the initialcorrection value (d[x,y]), and the final correction value (delta[x,y])has the characteristic of being rounded in the direction of approachingnegative infinity.

delta[x,y]=d[x,y]>>M[Equation5]

At this time, the binary digit M is preferably 1 or 2.

Finally, the first prediction value (pred1[x,y]) is added to the finalcorrection value (delta[x,y]), thus yielding the final prediction value(predS[x,y]).

$\begin{matrix}{{{{{pred}S}\left\lbrack {x,y} \right\rbrack} = {{Clip}\; 1{Y\left( {{{pred}\; {1\left\lbrack {x,y} \right\rbrack}} + {{delta}\left\lbrack {x,y} \right\rbrack}} \right)}}}{{Here},{{{Clip}\; 1_{Y}(x)} = {{Clip}\; 3\; \left( {0,\left( {{{1\left. {BitDepthY} \right)} - 1},x} \right),{{{Clip}\; 3\left( {x,y,z} \right)} = \left\{ {\begin{matrix}{x\text{:}} & {z < x} \\{y\text{:}} & {z > y} \\{z\text{:}} & {otherwise}\end{matrix},} \right.}} \right.}}}} & \left\lbrack {{Equation}\mspace{14mu} 6} \right\rbrack\end{matrix}$

and BitDepthY denotes a bit depth of a brightness signal.

According to another embodiment of the present invention, a plurality ofschemes may be used to generate the initial correction value (d[x,y])and produce the final correction value (delta[x,y]) using the initialcorrection value (d[x,y]). First, according to a first embodiment, thefinal correction value (delta[x,y]) may be produced through anarithmetic right shift operation after performing conditional analysison the initial correction value. According to the first embodiment, thefollowing equation may be used to calculate a correction value so thatthe correction value is rounded to be close to 0.

delta[x,y]=(d[x,y]+(d[x,y]<0?2^(x):0))>>(x+1)(in case of verticaldirection prediction mode)

delta[x,y]=(d[x,y]+(d[x,y]<0?2^(y):0))>>(y+1)(in case of horizontaldirection prediction mode)  [Equation 7]

Further, according to a second embodiment, the following equation may beused to calculate a correction value so that the correction value isrounded to be an integer away from 0.

delta[x,y]=(d[x,y]+(d[x,y]<0?1+2^(x):1))>>(x+1)(in case of verticaldirection prediction mode)

delta[x,y]=(d[x,y]+(d[x,y]<0?1+2^(y):1))>>(y+1)(in case of horizontaldirection prediction mode)  [Equation 8]

Further, according to a third embodiment, the following equation may beused to calculate a correction value so that the correction value isrounded to an integer close to negative infinity. At this time, Equation9 may apply only to a left boundary of a current block using thevertical direction prediction mode and an upper boundary of the currentblock using the horizontal direction prediction mode, and in such case,Equation 9 is the same as Equation 5 when M is 1.

delta[x,y]=d[x,y]>>(x+1)(in case of vertical direction prediction mode)

delta[x,y]=d[x,y]>>(y+1)(in case of horizontal direction predictionmode)  [Equation 9]

According to a fourth embodiment of the present invention, the initialcorrection value (d[x,y]) may be generated, and then, a Sign operationand an Abs operation may be used to calculate the final correction value(delta[x,y]) based on the initial correction value (d[x,y]). In suchcase, the final correction value (delta[x,y]) may be obtained bymultiplying a value obtained by performing a Sign operation on theinitial correction value by a value obtained by performing arithmeticright shift on an absolute value of the initial correction value. Atthis time, the final correction value may be calculated so that theobtained final prediction value is rounded to be an integer close to 0.

delta[x,y]=Sign(d[x,y])*((Abs(d[x,y])+2^(x))>>(x+1))(in case of verticaldirection prediction mode)

delta[x,y]=Sign(d[x,y])*((Abs(d[x,y])+2^(y))>>(y+1))(in case ofhorizontal direction prediction mode)  [Equation 10]

Further, the final correction value according to a fifth embodimentbased on the Sign operation and Abs operation may be obtained bymultiplying a value obtained by performing a Sign operation on theinitial correction value by a value obtained by performing an additionoperation on an absolute value of the initial correction value and thenperforming an arithmetic right shift on a resultant value of theaddition operation. At this time, the final correction value may becalculated so that the calculated final prediction value is rounded tobe an integer away from 0.

delta[x,y]=Sign(d[x,y])*((Abs(d[x,y])+2^(x))>>(x+1))(in case of verticaldirection prediction mode)

delta[x,y]=Sign(d[x,y])*((Abs(d[x,y])+2^(y))>>(y+1))(in case ofhorizontal direction prediction mode)  [Equation 11]

Then, based on the final correction value obtained in the first to fifthembodiments, the first prediction value (pred1[x,y]) may be added to thefinal correction value (delta[x,y]) to thereby produce the finalprediction value (predS[x,y]).

FIG. 9a is a view schematically illustrating an embodiment for producinga final prediction value by performing correction on a first predictionvalue when using a vertical mode.

Referring to FIG. 9a , the image encoding/decoding apparatus determinesa pixel value of an upper reference pixel of a current block 910 as afirst prediction value (pred1[x,y]=p[x,−1]) when performing intraprediction through a vertical direction prediction mode.

Then, the apparatus performs correction targeting pixels 920 positionedat a left boundary of the current block 910. To perform correction onthe first prediction value, an initial correction value is firstdetermined. At this time, the initial correction value is determineddepending on the vertical position of a prediction target pixel. Thatis, a difference between the value of a left reference pixel 940corresponding to the prediction target pixel and the value of a left andupper cornered pixel 930 may become the initial correction value(d[x,y]=d[y]=p[−1,y]−p[−1,−1]). As described above, the initialcorrection value is present only when x=0 in case of the left boundary,and may be otherwise 0.

Next, a final correction value is calculated by arithmeticright-shifting a two's complementary integer representation for theinitial correction value by a binary digit of 1(delta[x,y]=d[x,y]>>1=(p[−1,y]−p[−1,−1]) >>1).

Finally, the first pixel value is added to the final correction value,thus yielding a final prediction value(predS[x,y]=Clip1_(Y)(pred1[x,y]+delta[x,y]).

FIG. 9b is a view schematically illustrating an embodiment for producinga final prediction value by performing correction on a first predictionvalue when using a horizontal mode.

Referring to FIG. 9b , the image encoding/decoding apparatus determinesa pixel value of a left reference pixel of a current block 910 as afirst prediction value (pred1[x,y]=p[−1,y]) in the case of performingintra prediction through a horizontal direction prediction mode.

Then, the apparatus performs correction on pixels 950 positioned at anupper boundary of the current block 910. An initial correction value isdetermined depending on a horizontal position of a prediction targetpixel so as to perform correction on the first prediction value. Thatis, a difference between the value of an upper reference pixel 960corresponding to the prediction target pixel and the value of a left andupper cornered pixel 930 may become the initial correction value(d[x,y]=d[x]=p[x,−1]−p[−1,−1]). As described above, the initialcorrection value is present only when y=0 in the case of the upperboundary, and may be otherwise 0.

Next, a final correction value may be calculated by arithmetic rightshifting a two's complementary integer representation for the initialcorrection value by a binary digit of 1(delta[x,y]=d[x,y]>>1=(p[x,−1]−p[−1,−1]) >>1), and the first predictionvalue is added to the final correction value, thus yielding a finalprediction value (predS[x,y]=Clip1_(Y)(pred1[x,y]+delta[x,y]).

FIG. 10 is a flowchart schematically illustrating a process ofperforming scaling in an image encoding/decoding method according toanother embodiment of the present invention.

Referring to FIG. 10, the image encoding/decoding apparatus according tothe other embodiment of the present invention may perform scaling toproduce a motion vector of a prediction block when performing interprediction or motion compensation on a current block. For this purpose,the image encoding/decoding apparatus determines whether a referencepicture of the current block is the same as a reference picture of areference block (S1010). At this time, the image encoding/decodingapparatus may determine whether reference picture indexes indicatingreference pictures in a reference picture list are the same, but notonly the sameness of the reference picture. Then, depending on a resultof the determination, the image encoding/decoding apparatus determineswhether to perform scaling a motion vector of the reference block(S1020). In case the reference pictures are the same, no scaling on themotion vector of the reference block may be done, but otherwise, scalingfor the motion vector of the reference block is required. The scaledmotion vector of the reference block serves as a basis for the motionvector of the current block and may be used for inter prediction of thecurrent block.

Meanwhile, as inter prediction schemes applicable to the interprediction through scaling, there may be an AMVP (Advanced Motion VectorPrediction) or a merge mode. In particular, in the merge mode, thescheme may be applicable to a temporal merge candidate inducing processin the merge mode and to a temporal motion vector inducing process and aspatial motion vector inducing process in the AMVP.

FIG. 11a is a view illustrating a POC difference between a currentpicture and a current picture of a spatial reference block and a POCdifference between the current picture and a reference picture of thecurrent block.

Referring to FIG. 11a , the reference block 1110 for inducing a spatialmotion vector candidate among adjacent blocks of the current block 1100may be at least one of a lowermost block adjacent to the left side ofthe current block 1100, a block adjacent to the lower side of the leftand lowermost block, a left and upper cornered block of the currentblock, a right and upper cornered block of the current block and anupper and rightmost block adjacent to the current block. At this time,for the motion vector of the reference block 1110 to be able to be usedfor prediction of the current block 1100 without performing scaling, thereference picture 1140 of the reference block 1110 needs to be the sameas the reference picture 1130 of the current block 1100, and the motionvector of the reference block 1110 may be otherwise subjected to scalingand may be then used for prediction of the current block 1100. That is,it may be determined whether tb indicating a difference between thereference picture 1130 of the current block and POC (Picture OrderCount) of the current picture 1120 is the same as td indicating a POCdifference between the current picture 1120 and the reference picture1140 of the reference block 1110, and if the two are the same, noscaling is performed, and if the two are not the same, a scaling processmay be done.

FIG. 11b is a view illustrating a POC difference between a referencepicture of a co-located block and a co-located picture and a POCdifference between a current picture and a reference picture of acurrent block.

Referring to FIG. 11b , the image encoding/decoding apparatus mayperform prediction of the current block 1100 based on a motion vector ofa reference block associated with the co-located block 1150 at alocation corresponding to the current block 1100 in an alreadyreconstructed co-located picture 1160. That is, as a reference block forinducing a temporal motion vector or a temporal merge candidate, a blockpositioned in or outside the co-located block. The reference block maybe determined according to a relative position of a right and lowercornered block of the co-located block or a right and lower block amongfour square blocks with respect of the center of the co-located block.

At this time, in using the motion vector of the temporal referenceblock, it is determined whether td indicating a POC difference between areference picture 1170 referred to by the co-located block 1150 and theco-located picture 1160 is the same as tb indicating a POC differencebetween the reference picture 1130 referred to by the current block 1100and the current picture 1120. A determination may be made so that if thetwo values are the same, no scaling is performed, and if the two valuesare not the same, a scaling process is performed.

FIG. 12 is a flowchart schematically illustrating an embodiment of aprocess of calculating a scaling factor for a motion vector based on POCdifferences between pictures.

As shown in FIG. 12, the image encoding/decoding apparatus obtains tdand tb indicating POC differences between pictures so as to calculate ascaling factor (S1210). Here, the first value may refer to td, and thesecond value may refer to tb. As described above, i) in the process ofinducing a spatial motion vector (refer to FIG. 11a ), td denotes adifference between a POC of a current picture and a POC of a referencepicture referred to by a spatially adjacent reference block, and tbdenotes a difference between a POC of a current picture and a POC of areference picture referred to by the current block. At this time, thereference picture of the current block and the reference picture of thereference block may have different prediction directions, and in suchcase, td and tb may be assigned with different signs. In some cases, tdor tb may be adjusted to be included in a range from −128 to 127. Atthis time, if td or tb is smaller than −128, td or tb may be adjusted to−128, and if td or tb is larger than 127, td or tb may be adjusted to127. If td or tb is included in a range between −128 and 127, noadjustment is made to td or tb.

td=Clip3(−128,127,PicOrderCnt(currPic)−RefPicOrder(currPic,refIdxZ,ListZ))

tb=Clip3(−128,127,PicOrderCnt(currPic)−RefPicOrder(currPic,refIdxLX,LX))  [Equation12]

Here, currPic may denote a current picture. Further, X may have a valueof 0 or 1. For example, if X=0, refIdxLX and LX may be refIdxL0 and L0,respectively, which means variables associated with L0 temporal motioninformation. Further, refIdxLX may denote an LX reference picture indexindicating a reference picture in an LX reference picture list withreference pictures assigned therein. In case refIdxLX is 0, refIdxLX maydenote the first reference picture in the LX reference picture list, andin case refIdxLX is −1, refIdxLX may represent no indication of areference picture in the reference picture list. Further, Z may denoteat least one of a lowest block adjacent to the left side which is aposition of the reference block for inducing a spatial motion vector, ablock adjacent to a lower side of the left and lowermost block, a leftand upper cornered block of the current block, a right and uppercornered block of the current block, and an upper and rightmost blockadjacent to the current block.

ii) in the process of inducing a temporal motion vector, and iii) in theprocess of inducing a temporal merge candidate (refer to FIG. 11b ), tdmay denote a difference between a POC of a co-located picture and a POCof a reference picture referred to by a co-located block, and tb maydenote a difference between a POC of the current picture and a POC of areference picture referred to by the current block. In such case, td ortb may be also adjusted to be included in a range between −128 and 127.

td=Clip3(−128,127,PicOrderCnt(colPic)−RefPicOrder(currPic,refIdxCol,ListCol))

tb=Clip3(−128,127,PicOrderCnt(currPic)−RefPicOrder(currPic,refIdxLX,LX))  [Equation13]

Here, colPic may denote a co-located picture. Further, refIdxCol andListCol may denote a reference picture index of the co-located block anda reference picture list.

Once td and tb are obtained, the image decoding apparatus may yield anoffset value by arithmetic right-shifting a two's complementary integerrepresentation for an absolute value of td by a binary digit of 1(S1220). That is, the offset value may use a value proportional to theabsolute value of td and may be calculated by performing an arithmeticright shift having a relatively low complexity without performing ahigh-complexity operation.

offset=Abs(td)>>1  [Equation 14]

At this time, Abs( ) represents an absolute value function, and a valueoutput from the corresponding function is an absolute value of an inputvalue.

After performing the arithmetic right shift, the image encoding/decodingapparatus calculates an inverse-proportional value of td based on theoffset value (S1230).

tx=(16384+offset)/td  [Equation 15]

After the inverse-proportional value (tx) of td is calculated, a scalingfactor is calculated based on tb and the inverse-proportional value (tx)of td (S1240).

FIG. 13 is a block diagram schematically illustrating a configuration ofcalculating a final scaling factor based on tb and aninverse-proportional value of td. As shown in FIG. 13, the configuration1300 for calculating the final scaling factor (ScaleFactor) may includea multiplier 1310, an addition operating unit 1320, an arithmeticshifting unit 1330, and a factor adjusting unit 1340.

Referring to FIG. 13, a first and second value obtaining unit 1302obtains td and tb through the method described in step S1210. Then, anoffset value calculating unit 1306 calculates an offset value throughthe method described in step S1220 based on td, and aninverse-proportional value calculating unit 1308 calculates aninverse-proportional value (tx) of td through the method described inthe step S1230 based on the offset value.

The multiplier 1310 receives, as inputs, tb and the inverse-proportionalvalue (tx) of td calculated in the inverse-proportional valuecalculating unit 1308 and performs multiplication. The additionoperating unit 1320 may perform an addition operation based on themultiplication of tb and the inverse-proportional value (tx) of td. Atthis time, an operation of adding 32 may be performed. Then, thearithmetic shifting unit 1330 performs an arithmetic right shift on atwo's complementary integer representation on a resultant value of theaddition operation by a binary digit of 6. The operations performed thusfar may be represented as follows:

ScaleFactor=(tb*tx+32)>>6  [Equation 16]

Then, the factor adjusting unit 1340 adjusts the scaling factor(ScaleFactor) to be included in a range between −4096 and 4095. Here,adjusting the scaling factor to be included in a specific range (e.g.,between A and B) means clipping the factor to A if the scaling factor issmaller than A and to B if the scaling factor is larger than B.

After calculating the scaling factor, the image encoding/decodingapparatus may calculate a scaled motion vector (scaledMV). The scaledmotion vector (scaledMV) may be calculated by multiplying the scalingfactor (ScaleFactor) by the corresponding motion vector (which may meana motion vector associated with at least one of spatial motion vectorinduction, temporal motion vector induction and temporal merge),performing a Sign operation on the resultant value of themultiplication, performing an addition operation and an arithmetic shiftoperation on an absolute value of the resultant value of themultiplication, and multiplying the Signed value by the resultant valueof the addition and arithmetic shift operation.

scaled MV=Sign(ScaleFactor*mv)*((Abs(ScaleFactor*mv)+127)>>8)  [Equation17]

Here, Sign( ) outputs information on the sign of a specific value (e.g.,Sign(−1) outputs ‘−’), and my denotes a motion vector before scaling. Atthis time, scaling may be performed on each of an x component and a ycomponent of the motion vector.

The image encoding/decoding apparatus may generate a prediction block ofa current block using a motion vector scaled as above.

According to another embodiment of the present invention, theabove-described scaling factor calculating scheme may be also used in aprocess of calculating an in-implicit-weighted-prediction scalingfactor. The image encoding/decoding apparatus obtains td and tb thatdenote POC differences between pictures in order to calculate a scalingfactor upon performing the implicit weighted prediction.

td may denote a POC of a reference picture referred to by a currentpicture among reference pictures in a reference picture list 1 and a POCof a reference picture referred to by a current picture among referencepictures in a reference picture list 0, and tb may denote a differencebetween a POC of a current picture and a POC of a reference picturereferred to by the current picture among rep s in the reference picturelist 0. At this time, td or tb may be adjusted to be included in a rangebetween −128 and 127. At this time, if td or tb is smaller than −128, tdor tb may be adjusted to −128, and if td or tb is larger than 127, td ortb may be adjusted to 127. If td or tb is included in a range between−128 and 127, no adjustment is made to td or tb.

td=Clip3(−128,127,PicOrderCnt(currPic,refIdxL1,L1)−RefPicOrder(currPic,ref IdxL0,L0))

tb=Clip3(−128,127,PicOrderCnt(currPic)−RefPicOrder(currPic,refIdxL0,L0))  [Equation 18]

Then, the image decoding apparatus may calculate an offset value byperforming an arithmetic right shift on a two's complementary integerrepresentation for an absolute of td by a binary digit of 1.

After performing the arithmetic right shift, the image encoding/decodingapparatus calculates an inverse-proportional value(tx=(16384+offset)/td) of td based on the offset value, calculates aninverse-proportional value (tx) of td, and calculates a scaling factor(ScaleFactor=(tb*tx+32) >>6) based on tb and the inverse-proportionalvalue (tx) of td.

In particular, in calculating the in-implicit-weighted-predictionscaling factor, the scaling factor (ScaleFactor) may be adjusted to beincluded in a range between −1024 and 1023. At this time, in case thedistance between images increases, scaling on a weighting factor, whichis performed using the distance between images, may not be properlydone, and thus, incorrect implicit weighted prediction is performed,thus causing a deterioration of the encoding efficiency. Accordingly,rather than being included in a range between −1024 and 1023, thescaling factor may be adjusted to be included in a range between −4096and 4065.

At this time, by using the weighting factor, a weighting value for areference picture in the reference picture list 0 may be determined as64−(ScaleFactor >>2), and a weighting value for a reference picture inthe reference picture list 1 may be determined as ScaleFactor >>2.

Although in the embodiments the methods are described based onflowcharts with a series of steps or blocks, the present invention isnot limited to the order, and some steps may be performed simultaneouslywith or in a different sequence from other steps. Further, it may beunderstood by those skilled in the art that other steps may benon-exclusively included in the steps of the flowcharts or one or moresteps may be removed from the flowcharts without affecting the scope ofthe present invention.

The above-described embodiments include various aspects of examples.Although all possible combinations of the various aspects of examplesmay be not described herein, it will be understood by those skilled inthe art that such combinations are possible. Accordingly, the presentinvention includes all other modifications, variations, or changes thatmay be made to the appending claims.

1. A video decoding apparatus comprising: a prediction block generatorconfigured to generate a prediction block by performing inter predictionfor a current block, to determine whether to perform scaling on a motionvector of a reference block based on picture order count (POC) values ofa first reference picture of the current block and a second referencepicture of the reference block used for inter prediction for the currentblock, and to scale the motion vector of the reference block bycalculating a first value and a second value based on the POC values, tocalculate an offset value by performing an arithmetic right shift on anabsolute value of the first value by a binary digit of 1 and calculatingan inverse-proportional value of the first value using the offset value,and to calculate a scaling factor based on the inverse-proportionalvalue and the second value, in response to scaling of the motion vectorof the reference block being performed, wherein the first value is a POCdifference between a current picture and the second reference picture,the second value is a POC difference between the current picture and thefirst reference picture, the POC indicates the order of display output,and the motion vector of the reference block is scaled in response tothe POC difference between the current picture and the first referencepicture not being the same as the POC difference between the picturecomprising the reference block and the second reference picture when atemporal motion vector or a temporal merge candidate is induced.
 2. Avideo encoding method comprising: generating a prediction block byperforming inter prediction for a current block, determining whether toperform scaling on a motion vector of a reference block based on pictureorder count (POC) values of a first reference picture of the currentblock and a second reference picture of the reference block used forinter prediction for the current block, and scaling the motion vector ofthe reference block by calculating a first value and a second valuebased on the POC values, calculating an offset value by performing anarithmetic right shift on an absolute value of the first value by abinary digit of 1 and calculating an inverse-proportional value of thefirst value using the offset value, and calculating a scaling factorbased on the inverse-proportional value and the second value, inresponse to scaling of the motion vector of the reference block beingperformed, wherein the first value is a POC difference between a currentpicture and the second reference picture, the second value is a POCdifference between the current picture and the first reference picture,the POC indicates the order of display output, and the motion vector ofthe reference block is scaled in response to the first reference picturenot being the same as the second reference picture when a spatial motionvector is induced.
 3. A video decoding method comprising: generating aprediction block by performing inter prediction for a current block,determining whether to perform scaling on a motion vector of a referenceblock based on picture order count (POC) values of a first referencepicture of the current block and a second reference picture of thereference block used for inter prediction for the current block, andscaling the motion vector of the reference block by calculating a firstvalue and a second value based on the POC values, calculating an offsetvalue by performing an arithmetic right shift on an absolute value ofthe first value by a binary digit of 1 and calculating aninverse-proportional value of the first value using the offset value,and calculating a scaling factor based on the inverse-proportional valueand the second value, in response to scaling of the motion vector of thereference block being performed, wherein the first value is a POCdifference between a current picture and the second reference picture,the second value is a POC difference between the current picture and thefirst reference picture, the POC indicates the order of display output,the motion vector of the reference block is scaled in response to thefirst reference picture not being the same as the second referencepicture when a spatial motion vector is induced, the motion vector ofthe reference block is scaled in response to the POC difference betweenthe current picture and the first reference picture not being the sameas the POC difference between the picture comprising the reference blockand the second reference picture when a temporal motion vector or atemporal merge candidate is induced, and the scaling factor is derivedby performing an addition operation and an arithmetic right shiftoperation based on multiplication of the inverse-proportional value ofthe second value, and to adjust the scaling factor to be included in aspecific range.